#pragma once
# include "windows.h"
# include <wrl/client.h>
# include <stdint.h>
# include <vector>

struct ID3D11Texture2D;
struct ID3D11ShaderResourceView;
struct ID3D11Device;
struct ID3D11DeviceContext;
class BindAbleInterface;
class MyDx11;

class TextureDrawAble {
public:
	TextureDrawAble(MyDx11* _myDx11, int _width, int _height, bool _gpu_copy);
	void changeSize(MyDx11* _myDx11, int _width, int _height, bool _gpu_copy);
	void copyData(ID3D11Device* _device, ID3D11DeviceContext* _context, ID3D11Texture2D* _texture);
	void copyData(MyDx11* _myDx11, uint8_t* _buffer, size_t _size);
	void draw(MyDx11* _myDx11);
	void insertBindAble(BindAbleInterface* _bind_able);
	virtual ~TextureDrawAble();
private:
	Microsoft::WRL::ComPtr<ID3D11Texture2D> m_texture = nullptr;
	Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_texture_shader_resource = nullptr;
	std::vector<BindAbleInterface*>* m_bind_able = nullptr;
	HANDLE m_shared_handle = nullptr;
	
	int m_resource_view_index = 0;
protected:
	int m_index_size = 0;
	int m_width = 0;
	int m_height = 0;
	static ID3D11Device* getDevice(MyDx11* _myDx11) noexcept;
	static ID3D11DeviceContext* getContext(MyDx11* _myDx11) noexcept;
};
